package com.binyouwei.designpatterns.structural_type.adapter;

/**
 * @author 宾有为
 * @date 2024/7/11 20:13
 * @link https://blog.csdn.net/baidu_41616022?type=blog
 * @describe：
 **/
public class AdapterMediaAdapter implements AdapterMediaPlayer{
    AdapterAdvancedMediaPlayer advancedMusicPlayer;

    public AdapterMediaAdapter(String audioType){
        if(audioType.equalsIgnoreCase("vlc") ){
            advancedMusicPlayer = new AdapterVlcPlayer();
        } else if (audioType.equalsIgnoreCase("mp4")){
            advancedMusicPlayer = new AdapterMp4Player();
        }
    }

    @Override
    public void play(String audioType, String fileName) {
        if(audioType.equalsIgnoreCase("vlc")){
            advancedMusicPlayer.playVlc(fileName);
        }else if(audioType.equalsIgnoreCase("mp4")){
            advancedMusicPlayer.playMp4(fileName);
        }
    }
}
